package leedcode_path.treeNoDE;

public class 对称二叉树 {
    /*
    * 给你一个二叉树的根节点 root ， 检查它是否轴对称。*/
    public boolean isSymmetric(TreeNode root) {
        if (root==null) return true;
        return campare(root.left,root.right);







    }
    public boolean campare(TreeNode left,TreeNode right){
        if (left!=null&&right==null) return false;
        if (left==null&&right!=null) return false;
        if (left==null&&right==null) return true;
        if (left.val!=right.val) return false;
        boolean outside=campare(left.left,right.right);
        boolean inside=campare(left.right,right.left);
        return outside&&inside;
    }
}
